﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:51
 ******************************************************************************/

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// PiPermissionItemEntity
 /// 操作权限项定义
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
    [Serializable]
    public partial class PiPermissionItemEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private int? parentId = null;
        /// <summary>
        /// 父级主键
        /// </summary>
        public int? ParentId
        {
            get
            {
                return this.parentId;
            }
            set
            {
                this.parentId = value;
            }
        }

        private String code = string.Empty;
        /// <summary>
        /// 编号
        /// </summary>
        public String Code
        {
            get
            {
                return this.code;
            }
            set
            {
                this.code = value;
            }
        }

        private String fullName = string.Empty;
        /// <summary>
        /// 名称
        /// </summary>
        public String FullName
        {
            get
            {
                return this.fullName;
            }
            set
            {
                this.fullName = value;
            }
        }

        private String categoryCode = "Application";
        /// <summary>
        /// 什么类型
        /// </summary>
        public String CategoryCode
        {
            get
            {
                return this.categoryCode;
            }
            set
            {
                this.categoryCode = value;
            }
        }

        private int? isScope = 0;
        /// <summary>
        /// 权限域
        /// </summary>
        public int? IsScope
        {
            get
            {
                return this.isScope;
            }
            set
            {
                this.isScope = value;
            }
        }

        private int? isPublic = 0;
        /// <summary>
        /// 是公开
        /// </summary>
        public int? IsPublic
        {
            get
            {
                return this.isPublic;
            }
            set
            {
                this.isPublic = value;
            }
        }

        private int? allowEdit = 1;
        /// <summary>
        /// 允许编辑
        /// </summary>
        public int? AllowEdit
        {
            get
            {
                return this.allowEdit;
            }
            set
            {
                this.allowEdit = value;
            }
        }

        private int? allowDelete = 1;
        /// <summary>
        /// 允许删除
        /// </summary>
        public int? AllowDelete
        {
            get
            {
                return this.allowDelete;
            }
            set
            {
                this.allowDelete = value;
            }
        }

        private DateTime? lastCall = null;
        /// <summary>
        /// 最后被调用日期
        /// </summary>
        public DateTime? LastCall
        {
            get
            {
                return this.lastCall;
            }
            set
            {
                this.lastCall = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标记
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? sortCode = null;
        /// <summary>
        /// 排序码
        /// </summary>
        public int? SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PiPermissionItemEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPermissionItemEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPermissionItemEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPermissionItemEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPermissionItemEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPermissionItemEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldParentId]);
            this.Code = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldCode]);
            this.FullName = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldFullName]);
            this.CategoryCode = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldCategoryCode]);
            this.IsScope = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldIsScope]);
            this.IsPublic = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldIsPublic]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldAllowDelete]);
            this.LastCall = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionItemTable.FieldLastCall]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldEnabled]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldDeleteMark]);
            this.SortCode = BusinessLogic.ConvertToInt(dataRow[PiPermissionItemTable.FieldSortCode]);
            this.Description = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionItemTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionItemTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[PiPermissionItemTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPermissionItemEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldParentId]);
            this.Code = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldCode]);
            this.FullName = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldFullName]);
            this.CategoryCode = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldCategoryCode]);
            this.IsScope = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldIsScope]);
            this.IsPublic = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldIsPublic]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldAllowDelete]);
            this.LastCall = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionItemTable.FieldLastCall]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldEnabled]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldDeleteMark]);
            this.SortCode = BusinessLogic.ConvertToInt(dataReader[PiPermissionItemTable.FieldSortCode]);
            this.Description = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionItemTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionItemTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[PiPermissionItemTable.FieldModifiedBy]);
            return this;
        }
    }
}
